<form action="${CONTEXT_PATH}/user/save" method="post" id="users_add" class="form-horizontal">
<#include "/WEB-INF/template/page/admin/user/_form.ftl"/>
</form>
<script type="text/javascript">
    jQuery("#users_add").ready(function () {
        $(this).find("#liveflag").val("${m.liveflag!}");

        phoneChina();  //添加手机号码验证phoneChina
        // 定义验证参数
        var validateOptions = $.extend(CONST_VALIDATE.OPTION, {
            rules: {
                "m.loginid": {
                    required: true,
                    maxlength: 45
                },
                "m.name": {
                    required: true,
                    maxlength: 15
                },
                "m.phone": {
                    required: true,
                    phoneChina: true
                }
            },
            messages: {
                "m.loginid": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入登录ID",
                    maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>登录ID不能大于{0}个字符")
                },
                "m.name": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入用户昵称",
                    maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>用户昵称不能大于{0}个字符")
                },
                "m.phone": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入手机号码",
                    phoneChina: "<i class='fa fa-exclamation tooltips'></i>请输入正确的手机号码",
                }
            },
            submitHandler:function(form) {
                var modal = $("#ajax_add");
                $(form).ajaxSubmit(function (data, status, xhr) {
                    if (data.status) {
                        toastr.success(data.msg, '操作提示');
                    } else {
                        toastr.error(data.msg, '操作提示');
                    }
                });
                $(modal).modal('hide');
                dtgrid.load();
            }
        });
        //表单验证
        var validator = $("#users_add").validate(validateOptions);
    });
</script>